{{response.files.append(URL(r=request,c='static',f='ui.core.js'))}}
{{response.files.append(URL(r=request,c='static',f='ui.draggable.js'))}}
{{response.files.append(URL(r=request,c='static',f='ui.resizable.js'))}}
{{response.files.append(URL(r=request,c='static',f='fullcalendar.min.js'))}}
{{response.files.append(URL(r=request,c='static',f='fullcalendar.css'))}}
{{extend 'layout.html'}}

<script type='text/javascript'>

    $(document).ready(function() {
    
        var date = new Date();
        var d = date.getDate();
        var m = date.getMonth();
        var y = date.getFullYear();
        
        $('#calendar').fullCalendar({
            editable: false,
            events: [
            {{for a in appointments:}}
                {
                    title: '{{=(a.patient.last_name).replace("'","\\'")}}',
                    allDay: false,
                    start: new Date('{{=a.start_time.strftime('%B %d, %Y %H:%M:%S')}}'),
                    stop: new Date('{{=a.stop_time.strftime('%B %d, %Y %H:%M:%S')}}'),
                    url: '{{=URL(r=request,f='read',args=['patient',a.patient])}}',
                },
            {{pass}}            
            ]
        });
        
    });
</script>
<div id='calendar'></div>
